package com.yhb.service.impl;

import com.yhb.channel.model.ChannelLocation;
import com.yhb.channel.provider.IGeographicLocationProvider;
import com.yhb.utils.Constants;
import com.yhb.utils.POIUtil;
import lombok.var;
import org.springframework.stereotype.Service;

@Service
public class GEOImpl implements IGeographicLocationProvider {
    @Override
    public ChannelLocation getLocation() {
        var loc = POIUtil.gps2Poi(Constants.getCurrentGPSOrError());
        return ChannelLocation.builder()
                .province(loc.getProvince())
                .city(loc.getCity())
                .area(loc.getDistrict())
                .build();
    }
}
